#include<iostream>
using namespace std;
class Complex //复数类
{
private://私有
    double real;//实数
    double imag;//虚数
public:
    Complex(double real=0,double imag=0)
    {
        this->real=real;
        this->imag=imag;
    }
    Complex operator+(int x);
    friend Complex operator+(Complex com1,int x);
    friend Complex operator+(int x,Complex com1);
    void print()
    {
        cout<< "real:"<< real<< "     imag:"<<imag <<endl;
    }

};


Complex operator+(Complex com1,int x)
{
    return Complex(com1.real+x,com1.imag);
}

Complex operator+(int x,Complex com1)
{
    return Complex(com1.real+x,com1.imag);
}

Complex Complex::operator+(int x)
{
    return Complex(real+x,imag);
}

int main()
{
    Complex com1(5,10),total;
//    total=com1+5;
    total=5 + com1;
    total.print();
    return 0;
}